package routers

import (
	"github.com/astaxie/beego"
	"softwareEngineering/controllers"
)

func init() {
	//var FilterUser = func(ctx *context.Context) {
	//	u := ctx.Input.Session("user").(models.User)
	//	beego.Info("u", u.Level)
	//	if u.Level != "2"{
	//		ctx.Redirect(302, "/login")
	//	}
	//}
	//beego.InsertFilter("/admin", beego.BeforeRouter, FilterUser)

	//基础的跳转操作
	beego.Router("/", &controllers.MainController{})
	beego.Router("/index", &controllers.MainController{})
	beego.Router("/home", &controllers.MainController{}, "get:Home")
	//退出登录
	beego.Router("/exit", &controllers.MainController{}, "get:ExitLogin")
	beego.Router("/baseKnowledge", &controllers.MainController{}, "get:BaseKnowledge")
	beego.Router("/queryUser", &controllers.MainController{}, "get:QueryUser")
	beego.Router("/updateUser", &controllers.MainController{}, "get:UpdateUser")
	beego.Router("/deleteUser", &controllers.MainController{}, "get:DeleteUser")
	//login 请求
	beego.Router("/login", &controllers.LoginController{}, "get:Login")
	beego.Router("/handleLogin", &controllers.LoginController{}, "post:HandleLogin")
	//register request
	beego.Router("/register", &controllers.RegisterController{}, "get:Register")
	beego.Router("/handleRegister", &controllers.RegisterController{}, "post:HandleRegister")
	//	upload 操作
	beego.Router("/upForm", &controllers.UploadController{}, "get:UpForm")
	beego.Router("/upFile", &controllers.UploadController{}, "post:UpFile")
	//	admin 操作
	beego.Router("/admin", &controllers.AdminController{})
	//	删除文章操作
	beego.Router("/admin/deleteArticle", &controllers.AdminController{}, "get:DeleteArticle")
	//预览文章
	beego.Router("/admin/deployArticle", &controllers.AdminController{}, "get:DeployArticle")
	beego.Router("/admin/articleShow", &controllers.AdminController{}, "get:CheckArticle")

	//跳转到图片展示页面
	beego.Router("/admin/showImage", &controllers.AdminController{}, "get:ShowImage")
	//	切换图片查看方式

	beego.Router("/admin/imageShow", &controllers.AdminController{}, "get:ImageShow")
	beego.Router("/admin/imageShow2", &controllers.AdminController{}, "get:ImageShow2")

	//  删除图片操作
	beego.Router("/admin/imageShow/deleteImage", &controllers.AdminController{}, "get:DeleteImages")
	//删除video操作
	beego.Router("/admin/deleteVideo", &controllers.AdminController{}, "get:DeleteVideo")
	beego.Router("/admin/playVideo", &controllers.AdminController{}, "get:PlayVideo")
	beego.Router("/admin/releaseVideo", &controllers.AdminController{}, "post:ReleaseVideo")

	//前端书本模型处理
	beego.Router("/admin/book", &controllers.AdminController{}, "get:Book")
	beego.Router("/admin/bookSubmit", &controllers.AdminController{}, "post:BookSubmit")
	beego.Router("/admin/book/updatePage", &controllers.AdminController{}, "get:ShowPageInforById")

	//	用户个人信息修改
	beego.Router("/admin/updateInformation", &controllers.AdminController{}, "post:UpdateInformation")
	//子案例信息处理
	beego.Router("/admin/addSubcaseByName", &controllers.AdminController{}, "post:AddSubcaseByName")
	beego.Router("/admin/addSubcaseBySubmited", &controllers.AdminController{}, "post:AddSubcaseBySubmited")
	beego.Router("/admin/releaseSubcase", &controllers.AdminController{}, "get:ReleaseSubcase")
	beego.Router("/admin/revokeSubcase", &controllers.AdminController{}, "get:RevokeSubcase")

	//完整案例、子案例

	beego.Router("/getCompleteCase", &controllers.MainController{}, "get:ShowComplete")
	beego.Router("/getSubCase", &controllers.SubCase{}, "get:ShowSub")

}
